package com.txunda.zhuohired.aty.user.news;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.Html;
import android.widget.ImageView;
import android.widget.TextView;

import com.ants.theantsgo.gson.GsonUtil;
import com.ants.theantsgo.util.JSONUtils;
import com.ants.theantsgo.util.L;
import com.bumptech.glide.Glide;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.base.BaseAty;
import com.txunda.zhuohired.bean.user.my.SystemBean;
import com.txunda.zhuohired.http.pst.MessagePst;
import com.txunda.zhuohired.util.GlideCircleTransform;

import java.util.Map;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/6 11:44
 * 功能描述：消息详情
 * 联系方式：jiahuanchen@126.com
 */

public class SystemNewsDetailsAty extends BaseAty {
    /**
     * 标题
     */
    @ViewInject(R.id.tv_layout_white_center)
    private TextView tv_layout_white_center;
    @ViewInject(R.id.iv_system_img)
    private ImageView iv_system_img;
    @ViewInject(R.id.tv_news_details_content)
    private TextView tv_news_details_content;
    private String id;
    private MessagePst messagePst;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        showStatusBar(R.id.layout_white_head);
        tv_layout_white_center.setText("详情");
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.aty_system_news_details;
    }

    @Override
    protected void initialized() {
        messagePst = new MessagePst(this);
        id = getIntent().getStringExtra("id");
    }

    @Override
    protected void requestData() {
        messagePst.sysMsgInfo(id);
    }

    @Override
    public void onComplete(String requestUrl, String jsonStr) {
        super.onComplete(requestUrl, jsonStr);
        if(requestUrl.contains("sysMsgInfo")){
            L.e("===========",jsonStr);
            SystemBean systemBean = GsonUtil.GsonToBean(jsonStr,SystemBean.class);

            tv_news_details_content.setText(Html.fromHtml(systemBean.getData().getSys_msg_content()));

//            Glide.with(this).load(data.get("content_img")).error(R.mipmap.default_image)
//                    .placeholder(R.mipmap.default_image)
//                    .transform(new GlideCircleTransform(this))
//                    .into(iv_system_img);
        }

    }
}
